import java.util.ArrayList;
import java.util.List;

class Allergies {
    private int eggsScore;

    Allergies(int i) {
        this.eggsScore = i;
    }

    boolean isAllergicTo(Allergen eggs) {
        return (this.eggsScore & eggs.getScore()) ==  eggs.getScore();
    }

    List<Allergen> getList() {
        List<Allergen> results = new ArrayList<>();

        for (Allergen a : Allergen.values()) if ((this.eggsScore & a.getScore()) == a.getScore()) results.add(a);

        return results;
    }
}
